import tool from 'src/util/tool'
import util from '_util/index';

export default{
  init2(_this){
    let l = _this.attr_group.length

    let copyTarget = _this.attr_group[0] ? _this.attr_group[0][0] : _this.attr[0]
    let first = util.deepCopy(copyTarget)
    for(let i=0;i<_this.group.length;i++) {
      let item = _this.attr_group[i];
      if(item&&item.length>0) {
        continue;
      }else{
        item = [first];
        item[0].id = -1;
        item[0].title = '占位（请忽略）';
        // _this.attr_group[i] = item;
        _this.$set(_this.attr_group, i, item);
      }
    }

    _this.pro_attr_group_str()
  },
  yes_event(_this){
    let vo = _this.$store.state.global.editVoModal;
    if (_this.group.contains(vo.group_name)) {

      alert('该分组已存在')
      return
    }
    _this.group.push(vo.group_name)
    if(_this.tab_title) {
      _this.tab_title.push(vo.tab_title);
    }
    let l = _this.attr_group.length

    let copyTarget = _this.attr_group[0] ? _this.attr_group[0][0] : _this.attr[0]

    let first = util.deepCopy(copyTarget)
    _this.attr_group[l] = [first]
    _this.attr_group[l][0].id = -1;
    _this.attr_group[l][0].title = '占位（请忽略）';
  }

}
